import matplotlib.pyplot as plt
from next_level.Finance_Data.make_plot import makeplot
from next_level.Finance_Data.stock_load import load_stock

'''
拆分图表，进行子图绘制
'''

def do_spilt_plot(stock_df,name_str):
    '''绘图函数，包括子图绘制
    使用从网络读取的股票数据 stock_df
    '''
    plt.subplot(2,1,1)    # 绘制上面一半图形
    makeplot(stock_df,'Close','price')
    plt.title(name_str + ' Price/Volume')

    plt.subplot(2, 1, 2)  # 绘制下面一半图形
    makeplot(stock_df, 'Volume','volume')
    plt.show()


if __name__ == '__main__':
    stock_df = load_stock('MSFT')
    do_spilt_plot(stock_df,'MSFT')


